﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DataSetTopDatabases" targetNamespace="http://tempuri.org/DataSetTopDatabases.xsd" xmlns:mstns="http://tempuri.org/DataSetTopDatabases.xsd" xmlns="http://tempuri.org/DataSetTopDatabases.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="SQLServerOptimizerConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="SQLServerOptimizerConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.SQLServerOptimizer.PL.WPF.Properties.Settings.GlobalReference.Default.SQLServerOptimizerConnectionString" Provider="System.Data.SqlClient" />
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="TopDatabasesTableAdapter" GeneratorDataComponentClassName="TopDatabasesTableAdapter" Name="TopDatabases" UserDataComponentName="TopDatabasesTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="SQLServerOptimizerConnectionString (Settings)" DbObjectName="SELECT db.name, MIN(dbd.TimeID) AS timeMin, MAX(dbd.TimeID) AS timeMax, dbd.PerfDatabaseID FROM Performance.PerfDatabaseData AS dbd INNER JOIN Performance.PerfDatabase AS db ON dbd.PerfDatabaseID = db.PerfDatabaseID INNER JOIN Performance.Time ON dbd.TimeID = Performance.Time.TimeID INNER JOIN Performance.Trace ON Performance.Time.TraceID = Performance.Trace.TraceID INNER JOIN Performance.Instance AS Inst ON db.InstanceID = Inst.InstanceID INNER JOIN Performance.PerfServer AS Serv ON Inst.PerfServerID = Serv.PerfServerID WHERE (@ServerID = Serv.PerfServerID) AND (@TraceID = Performance.Trace.TraceID) GROUP BY dbd.PerfDatabaseID, db.name" DbObjectType="Unknown" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT        TOP (5) a.name, amax.num_of_reads - amin.num_of_reads AS reads, amax.num_of_writes - amin.num_of_writes AS writes, 
                         (amax.num_of_reads - amin.num_of_reads) + (amax.num_of_writes - amin.num_of_writes) AS total
FROM            (SELECT        db.name, MIN(dbd.TimeID) AS timeMin, MAX(dbd.TimeID) AS timeMax, dbd.PerfDatabaseID
                          FROM            Performance.PerfDatabaseData AS dbd INNER JOIN
                                                    Performance.PerfDatabase AS db ON dbd.PerfDatabaseID = db.PerfDatabaseID INNER JOIN
                                                    Performance.Time ON dbd.TimeID = Performance.Time.TimeID INNER JOIN
                                                    Performance.Trace ON Performance.Time.TraceID = Performance.Trace.TraceID INNER JOIN
                                                    Performance.Instance AS Inst ON db.InstanceID = Inst.InstanceID INNER JOIN
                                                    Performance.PerfServer AS Serv ON Inst.PerfServerID = Serv.PerfServerID
                          WHERE        (@ServerID = Serv.PerfServerID) AND (@TraceID = Performance.Trace.TraceID)
                          GROUP BY dbd.PerfDatabaseID, db.name) AS a INNER JOIN
                         Performance.PerfDatabaseData AS amin ON a.timeMin = amin.TimeID AND a.PerfDatabaseID = amin.PerfDatabaseID INNER JOIN
                         Performance.PerfDatabaseData AS amax ON a.timeMax = amax.TimeID AND a.PerfDatabaseID = amax.PerfDatabaseID
ORDER BY total DESC</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="ServerID" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Int32" Direction="Input" ParameterName="@ServerID" Precision="0" ProviderType="Int" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="TraceID" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Int32" Direction="Input" ParameterName="@TraceID" Precision="0" ProviderType="Int" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="name" DataSetColumn="name" />
              <Mapping SourceColumn="total" DataSetColumn="total" />
              <Mapping SourceColumn="reads" DataSetColumn="reads" />
              <Mapping SourceColumn="writes" DataSetColumn="writes" />
            </Mappings>
            <Sources />
          </TableAdapter>
        </Tables>
        <Sources />
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="DataSetTopDatabases" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DataSetTopDatabases" msprop:Generator_UserDSName="DataSetTopDatabases">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="TopDatabases" msprop:Generator_TableClassName="TopDatabasesDataTable" msprop:Generator_TableVarName="tableTopDatabases" msprop:Generator_RowChangedName="TopDatabasesRowChanged" msprop:Generator_TablePropName="TopDatabases" msprop:Generator_RowDeletingName="TopDatabasesRowDeleting" msprop:Generator_RowChangingName="TopDatabasesRowChanging" msprop:Generator_RowEvHandlerName="TopDatabasesRowChangeEventHandler" msprop:Generator_RowDeletedName="TopDatabasesRowDeleted" msprop:Generator_RowClassName="TopDatabasesRow" msprop:Generator_UserTableName="TopDatabases" msprop:Generator_RowEvArgName="TopDatabasesRowChangeEvent">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="name" msprop:Generator_ColumnVarNameInTable="columnname" msprop:Generator_ColumnPropNameInRow="name" msprop:Generator_ColumnPropNameInTable="nameColumn" msprop:Generator_UserColumnName="name" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="4000" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="total" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columntotal" msprop:Generator_ColumnPropNameInRow="total" msprop:Generator_ColumnPropNameInTable="totalColumn" msprop:Generator_UserColumnName="total" type="xs:long" minOccurs="0" />
              <xs:element name="reads" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnreads" msprop:Generator_ColumnPropNameInRow="reads" msprop:Generator_ColumnPropNameInTable="readsColumn" msprop:Generator_UserColumnName="reads" type="xs:long" minOccurs="0" />
              <xs:element name="writes" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnwrites" msprop:Generator_ColumnPropNameInRow="writes" msprop:Generator_ColumnPropNameInTable="writesColumn" msprop:Generator_UserColumnName="writes" type="xs:long" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>